package com.myTimeUtils.android.TimeTracker.View;
import com.myTimeUtils.android.TimeTracker.Schedule.*;
import com.myTimeUtils.android.TimeTracker.System.CurrentTime; 
import android.util.Log;
/**
 * Decorates the ScheduleManager class so that it may be integrated into the view.
 *
 * @author Joseph Walker
 */
public class ScheduleInfo extends ScheduleManager{
	private UpdatableView view;
	/**
	 * Constructs the link between the schedule module and the view
	 *
	 * @param view		The view that will be updated.
	 */
	public ScheduleInfo(UpdatableView view){
		this.setView(view);
		//For test
		Period p = new Period(new Time(Time.SATURDAY, 12, 1), "Init", new Time(Time.SATURDAY, 10, 12));
		addPeriod(p, Schedule.SATURDAY);
	}
	/**
	 * Updates the schedule to the current period and tells the view.
	 */
	public void notifyObserver(){
		Log.d("Process", "Update Decorator");
		super.notifyObserver();
		this.view.updateView(this.getCurrentPeriod().getName() + " : " + this.getCurrentPeriod().remainingTime(CurrentTime.getTime()));
	}
	private void setView(UpdatableView view){ this.view = view; }
}
